// ignore_for_file: file_names, must_be_immutable, constant_identifier_names, slash_for_doc_comments, avoid_unnecessary_containers, prefer_const_constructors, unnecessary_cast, sized_box_for_whitespace, prefer_function_declarations_over_variables, overridden_fields, annotate_overrides, prefer_const_literals_to_create_immutables, unnecessary_null_comparison, deprecated_member_use
import 'dart:async';
import 'apple_maps_platform_interface.dart';

class AppleMaps {
  // 单例公开访问点
  factory AppleMaps() => _sharedInstance();

  // 静态、同步、私有访问点
  static AppleMaps _sharedInstance() {
    return _instance;
  }

  // 静态私有成员，没有初始化
  static final AppleMaps _instance = AppleMaps._();

  // 私有构造函数
  AppleMaps._() {}

  Future<String?> getPlatformVersion() {
    return AppleMapsPlatform.instance.getPlatformVersion();
  }

  /**
   * @title 参数
   * @info annotationIcon: 正方形，该图片需要放入Assets.xcassets中
   * @info annotationIconSize:图片大小，
   * @info regionDistance:显示的区域距离 多少米，
   */
  static Map<String, String> creationParams({
    String? content,
    String? annotationIcon,
    String annotationIconSize = "40",
    String regionDistance = "500",
  }) {
    return {
      "content": content ?? "",
      "annotationIcon": annotationIcon ?? "",
      "annotationIconSize": annotationIconSize,
      "regionDistance": regionDistance,
    };
  }

  /**
   * @title 启用指南针
   */
  Future<void> startCompass() {
    return AppleMapsPlatform.instance.startCompass();
  }

  /**
   * @title 结束指南针
   */
  Future<void> stopCompass() {
    return AppleMapsPlatform.instance.stopCompass();
  }

  /**
   * @title 获取流
   */
  StreamController<double> getCompassStream() {
    return AppleMapsPlatform.instance.getCompassStream();
  }
}
